import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    //  state  存放数据 相当于data
    state: {
        isLogin: false,
        userInfo: "",
        Active: 0,
        MVId: '',
        MVList: '',

    },
    //  mutations  修改state中的数据  是一个函数   不能有异步操作
    mutations: {
        user(state, payload) {
            state.userInfo = payload.userInfo.res.data
        },
        login(state, payload) {
            state.isLogin = payload.isLogin
        },
        changeActive(state, payload) {
            state.Active = payload.Active
        },
        changeMVid(state, payload) {
            state.MVId = payload.MVId
        },
        changMVList(state, payload) {
            state.MVList = payload.MVList
        }
    },
    //  state
    getters: {},
    //  可以有异步   可以修改 mutations state
    actions: {},
    //  模块化
    modules: {}
})
